<?php 
/**
 * @Title: enclosing_method
 * @Description: 
 * @return: return_type
 * @author: weijuan.huang
 * @date: 2015-3-4下午4:56:37
*/
use common\models\SysUserSupplier;
use common\models\SysSupplier;

$this->title = '分配上游厂商';
$this->params ['breadcrumbs'] [] = $this->title;
?>
<style>
    table { width: 100%;}
    table td {
text-align: center;
height: 30px;
}
</style>
<div>
    <h3><?php echo $this->title?></h3>
    <br />
    <?php if(isset($msg)){echo '<span style="color:#f00;">'.$msg.'</span>';} ?>
    <form action="/sys-admin-user/addsupplier" method="POST" id="priv-form" name="priv-form">
    <div class="form-group">
    <label class="control-label">管理员：</label>
    <strong><?php echo $adminname['user_name'];?></strong>
    <input type='hidden' name='uid' value='<?php echo $user_id;?>'>
    </div>
    <?php if (!empty($supplier)) {?>
        <div class="form-group" style="height:25px;">
		<label class="control-label" style="float: left;">上游厂商：</label>
                <select id="sid" class="form-control" name="sid" style="float: left; width: 200px;">
                <?php foreach ($supplier as $value) {?>
                    <option value="<?=$value['id']?>"><?=$value['name']?></option>
                <?php  }?>
                </select>&nbsp;<button type="submit" name='save' class="btn btn-success">添加</button>
    </div>
                <table bordercolor="#ccc" height="40" cellpadding="1" align="left" border="1">
            <tbody><tr class="">
                    <td style="width:30%;">编号</td>
                <td style="width:40%;">特权名称</td>
                <td style="width:30%;">操作</td>
            </tr>
            <?php foreach ($user_supplier as $usval){
                    $supp = SysSupplier::find()->where(['id'=>$usval['sid']])->asArray()->all();
                    foreach ($supp as $suval){
                    ?>
                        <tr class="trclass">
                <td><a class="yulan" href="javascript:void(0)"><?php echo $suval['id']; ?></a></td>
                <td><?php echo $suval['name']; ?></td>
                                <td>
                	<a href="/sys-admin-user/deletesupplier?sid=<?php echo $usval['sid']; ?>&uid=<?php echo $user_id; ?>" class="glyphicon glyphicon-remove"></a>
            </td>
                                
            </tr>
            <?php }}?>
                    </tbody></table>

    <?php }?>
    

	</form>
</div>